package com.qdu.mq;

import com.qdu.entity.Mytrace;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Slf4j
@Component
public class RabbitProducer {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void addMytraceQueue(List<Mytrace> mytraces) {
        // 第一个参数为刚刚定义的队列名称
        this.rabbitTemplate.convertAndSend("addMytraceQueue", mytraces);
    }
}